package br.com.felinelayer.client.clientSwing;

import br.com.felinelayer.common.Protocol;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.JButton;

/**
 *
 */
public class Button extends ComponentSwing<Button, JButton>  implements ActionListener, br.com.felinelayer.client.IButton {

    @Override
    protected void doInitialize() {
        jButton = initializeComponente(new JButton());
        jButton.addActionListener( this );
    }
    private JButton jButton;


    @Override
    public Button setText( String text ) {
        jButton.setText( text );
        return this;
    }

    @Override
    public void actionPerformed( ActionEvent e ) {
        try {
            fireEvent(Protocol.EVENT_CLICK);
        } catch (Exception ex) {
            Logger.getLogger(Button.class.getName()).log(Level.SEVERE, null, ex);
        }
    }

    @Override
    public String getText() {
        return jButton.getText();
    }


}
